<script type="text/javascript">
    $(document).ready(function(){
        $('#bt_loadmore').click(function(){
            $('#bt_loadmore img').fadeIn();
            var offset = $('#current_offset').val();
            $.post('~home/loadMoreLastestProduct', {offset : offset} , function(data){
                $('#bt_loadmore img').fadeOut();
                if(data.indexOf('COMPLETE') == -1){
                    $('#lastest_product_area').append(data);
                    $('#current_offset').val(parseInt(offset) + 5);
                    $.sortProduct();
                }
                else{
                    $('#bt_loadmore').fadeOut();
                }
            });
        });
    });
</script>
<div class="params">
    <input type="hidden" value="10" id='current_offset'>
</div>
<!-- Hot product slider -->
<?php 
    if($template->get('aHotProducts'))
    {
        includeBlock('block/categorySlideBlock');
        $aParams = array(
            'aProducts' => $template->get('aHotProducts'),
        );
        includeBlock('block/hotProductBlock',$aParams); 
    }
?>
<?php
    if($template->get('aSuggetionProduct'))
    {
        echo '<h2 class="title green_style">DÀNH CHO BẠN</h2>';
        $aParams = array(
            'aProducts' => $template->get('aSuggetionProduct'),
            'layout' => 'default',
            'noHightLight' => true,
        );
        includeBlock('block/productBlock', $aParams);
    }
?>
<h2 class="title red_style">SẢN PHẨM ĐƯỢC QUAN TÂM NHẤT</h2>
<?php
    $aParams = array(
        'aProducts' => $template->get('top10Product'),
        'layout' => 'default',
        'noHightLight' => true,
    );
    includeBlock('block/productBlock', $aParams);
?>
<h2 class="title bright_green_style">SẢN PHẨM MỚI NHẤT</h2>

<!-- Lastest product content -->
<?php 
    if($template->get('aProducts'))
    {
        $aParams = array(
            'aProducts' => $template->get('aProducts'),
            'id' => 'lastest_product_area',
        );

        includeBlock('block/productBlock', $aParams);
    }
?>
<div style="clear: both;"></div>
<div id="bt_loadmore"><img src="<?php echo URL::getLink('image/loading'); ?>" alt=""> MORE...</div>
<div style="padding: 5px;"></div>